/**
 * @description 汇总组件
 * @author wangjianjun
 */

import React, { PropTypes, PureComponent, Fragment } from 'react';
import { PrimaryC, DATA_ENTRY, FirstHeaderC, AdvancedSearch, NoQueryC, TableC } from '../../../../comps';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Row, Col, Card, Popconfirm, Input, Button, message, Table, Divider, DatePicker, Select, Modal, Tooltip } from 'antd';
const confirm = Modal.confirm;
import { connect } from 'dva';
import moment from 'moment';
import style from '../index.less';

@Form.create()
@connect(({ positionInquiryM }) => ({
  positionInquiryM,
}))
export default class TotalAccount extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }
  componentDidMount() {}

  UNSAFE_componentWillReceiveProps(nextProps) {}

  render() {
    let account = this.props.account;

    return (
      <div className={style.accountRow} style={{ marginTop: '10px' }}>
        {this.props.type && this.props.type == '1' ? (
          <Row style={{ marginLeft: '10px' }}>
            {account.amount || account.amount == 0 ? (
              <Col span={4}>
                {' '}
                <span style={{ paddingLeft: '20px' }}>数量&nbsp;&nbsp;{`${account.amount}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={4}>
                {' '}
                <span>{`数量`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.marketValue || account.marketValue == 0 ? (
              <Col span={5}>
                {' '}
                <span>市值&nbsp;&nbsp;{`${account.marketValue}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>{`市值`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.enFloatProfit || account.enFloatProfit == 0 ? (
              <Col span={5}>
                {' '}
                <span>浮动盈亏&nbsp;&nbsp;{`${account.enFloatProfit}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>{`浮动盈亏`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.costRatio || account.costRatio == 0 ? (
              <Col span={5}>
                {' '}
                <span>成本收益率&nbsp;&nbsp;{`${account.costRatio}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>{`成本收益率`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.exerciseCostRatio || account.exerciseCostRatio == 0 ? (
              <Col span={5}>
                {' '}
                <span>成本收益率（行权）&nbsp;{`${account.exerciseCostRatio}`}</span>{' '}
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>成本收益率（行权）--</span>
              </Col>
            )}
          </Row>
        ) : (
          <Row style={{ marginLeft: '10px' }}>
            {account.amount || account.amount == 0 ? (
              <Col span={4}>
                {' '}
                <span style={{ paddingLeft: '20px' }}>数量&nbsp;&nbsp;{`${account.amount}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={4}>
                {' '}
                <span>{`数量`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.marketValue || account.marketValue == 0 ? (
              <Col span={5}>
                {' '}
                <span>市值&nbsp;&nbsp;{`${account.marketValue}`}</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>{`市值`}&nbsp;&nbsp;--</span>{' '}
                <span className={style.shuxian}>
                  <Divider type='vertical' />
                </span>{' '}
              </Col>
            )}
            {account.enFloatProfit || account.enFloatProfit == 0 ? (
              <Col span={5}>
                {' '}
                <span>浮动盈亏&nbsp;&nbsp;{`${account.enFloatProfit}`}</span>
              </Col>
            ) : (
              <Col span={5}>
                {' '}
                <span>{`浮动盈亏`}&nbsp;&nbsp;--</span>{' '}
              </Col>
            )}
          </Row>
        )}
      </div>
    );
  }
}
